package com.yundou.www.wrpc.core.net;

import java.util.HashMap;
import java.util.Map;

/**
 * @author wangweiwei
 * @since 2021/7/22
 */
public class NettyServerManager {

    private static Map<Integer ,NettyServer> serverMap = new HashMap<>(16);



    public static void addServer(Integer port , NettyServer nettyServer) {
        serverMap.put(port , nettyServer);
    }

    public static void start() {
        if (serverMap == null || serverMap.isEmpty()) {
            return;
        }
        serverMap.forEach((k , v) -> v.startServer());
    }


    public static void stop() {
        if (serverMap == null || serverMap.isEmpty()) {
            return;
        }
        serverMap.forEach((k , v) -> v.stopServer());
    }
}
